<script setup>
const props = defineProps({
  options: {
    type: Object,
    default: () => {
      return {}
    }
  }
})

const tAnimationConfig = computed(() => {
  return {
    Basis: 'x',
    Duration: 2000,
    Length: props.options.xAxis ? props.options.xAxis.data.length : 99
  }
})
</script>

<template>
  <div style="width: 100%; height: 100%">
    <dv-border-box7 class="my-box7" :color="['#0749a3', '#4195d2']">
      <div class="dom-box">
        <div class="dom-title">设备在线统计</div>
        <div class="dom-content">
          <div class="chart-content" v-if="props.options">
            <ps-chart2 :option="props.options" tooltipAnimation :tAnimationConfig="tAnimationConfig" />
          </div>
        </div>
      </div>
    </dv-border-box7>
  </div>
</template>

<style scoped lang="scss">
.dom-box {
  display: flex;
  flex-direction: column;
  height: 100%;

  .dom-title {
    height: 40px;
    background-color: rgba(14, 58, 119, 0.6);
    color: #2ca7e2;
    line-height: 40px;
    padding-left: 20px;
  }

  .dom-content {
    flex: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .chart-content {
    flex: 1;
    overflow: hidden;

    height: calc(100% - 70px);
  }
}
</style>
